in structured text you can use timer as function. Working of timer is same as ladder logic but in structured text parameter of timer is defined as function. So in timer function have some parameter like IN (input) input start the timer operation, PT (preset time) value for timer operation, Q (output) and ET (elapsed time) current value of timer. You can use these variable multiple time in another or same program. In this article we discuss Timer On TON, Timer Off TOF, Timer with defined period TP
Timer ON Function (TON) In Structured text (ST) allows you to program a switch-on delay timer. Parameter for Timer On function is
so in above example of Timer ON Function (TON) In Structured text (ST) PROGRAMMING TON_1 is instance name of timer, timer_in is a timer input of timer, Timer_pt is timer preset value and timer_output is output of timer. at rising edge of when of TON timer operation start for specified Preset Time when elapsed time reaches to preset time than timer stop and output is set to true or 1. In second statements elapsed time converted it into Integer data type.
In Structured text (ST) allows you to program a off delay timer. Parameter for off delay timer is
so in above example of Timer ON Function (TON) In Structured text (ST) PROGRAMMING TOF_1 is instance name of timer, timer_in is a timer input of timer, Timer_pt is timer preset value and timer_output is output of timer. Off delay timer provide delay in output to set true to false, when input of timer is change from true to false. In off delay timer, when timer input is set to true so output is set to true. if the input of timer is change from true to false than timer operation start until timer preset value equal to timer current value(timer_et) if the timer preset value and timer current value is equal than timer output is set to false or off.
Pulse Timer (TP) function block is a pulse timer with a defined clock period.
generation of clock pulse is depend on input bit of pulse timer function at each rising of input bit of timer, this function generate pulse for defined preset value time. in above example of Pulse Timer (TP) function when input of timer is change from false to true than this function generate pulse. Once timer operation is started and input of timer is change than timer continue generate pulses until it reaches defined preset value. Once preset value is equal to current value than timer done bit is set and timer stop pulse generation.
Information about Structured text visit link below